package com.huangsm.cloud.consumer.feign;

import com.huangsm.cloud.config.FeignConfiguration;
import com.huangsm.cloud.consumer.entity.User;
import com.huangsm.cloud.consumer.feign.fallback.HystrixClientFactroy;
import com.huangsm.cloud.consumer.feign.fallback.UserFeignHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * Feign方式调用服务
 * @author huangsm
 * @version V1.0
 */
@FeignClient(name = "service-provider",fallbackFactory = HystrixClientFactroy.class,configuration = FeignConfiguration.class)
public interface UserFeign {
    /**
     * 根据ID查询用户信息
     * @param id
     * @return
     */
    @GetMapping("/findUser/{id}")
    public User findUser(@PathVariable("id") Long id);

    /**
     * 得到注册服务的地址URL
     * @return
     */
     @GetMapping("/getHomeUrl")
    public String serviceUrl();
}
